/* This do-file replicates Table 1 and Figures 3 and 4 in Kerim Can Kavakli's article "Women's murders and the interaction between gender (in)equality and
economic development: A subnational analysis in Turkey" (Journal of Interpersonal Violence)	*/


* Set working directory
cd "..."

* LOAD dataset
use "wm_replication_dataset_2020_09_25.dta", clear


***********
* Table 1 *
***********

* Model 1
nbreg all_wm_prov i.year ethnic_t ethnic_k c.mosques_perk c.ln_casualty c.ln_gdppc_cons c.fm c.divorce_rate_ma5, cl(prov_code) exposure(total_pop)
est store baseline

* Model 2
nbreg all_wm_prov i.year ethnic_t ethnic_k c.mosques_perk c.ln_casualty##i.ceasefire c.ln_gdppc_cons##c.(fm divorce_rate_ma5), cl(prov_code) exposure(total_pop)
est store interax

* Model 3
nbreg knows_wm_prov i.year ethnic_t ethnic_k c.mosques_perk c.ln_casualty##i.ceasefire c.ln_gdppc_cons##c.(fm divorce_rate_ma5), cl(prov_code) exposure(total_pop)
est store interax_killer


***********
* Figures *
***********

* Figure 3 (rerun model for MARGINS - I edited graphs with Stata's Graph Editor)
nbreg knows_wm_prov i.year ethnic_t ethnic_k c.mosques_perk c.ln_casualty##i.ceasefire c.ln_gdppc_cons##c.(fm divorce_rate_ma5), cl(prov_code) exposure(total_pop)

margins, at(fm=(-0.15 (0.01) -0.05) ln_gdppc_cons=(3.9 4.9)) level(90) post
marginsplot, recast(line) recastci(rarea) ciopt(color(%40)) scheme(plotplain) ///
title("") ytitle("Predicted No of Women's Murders") xtitle("Gender Gap in Education")
graph export "educgap_wm.png", as(png) replace


* Figure 4 (rerun model for MARGINS - I edited graphs with Stata's Graph Editor)
nbreg `dv_all' `controls_full', cl(prov_code) exposure(total_pop)

margins, at(divorce_rate_ma5=(0.2 (0.2) 2.2) ln_gdppc_cons=(3.9 4.9)) level(90) post
marginsplot, recast(line) recastci(rarea) ciopt(color(%40)) scheme(plotplain) ///
title("") ytitle("Predicted No of Women's Murders") xtitle("Divorce Rates")
graph export "divorce_wm.png", as(png) replace


*********
* TABLE *
*********

esttab baseline interax*, b(3) se(3) noomit nobase compress star(* 0.1 ** 0.05) stats(N aic) varwidth(45)  ///
drop(*year*) order(ethnic* *mosq* *casualty* ln_gdppc_cons *divorce* *fm*) label mtitle 